home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / hypercrd / xcmd / dxcmds34.sit / Dartmouth XCMD's 3.4.3 / card_20541.txt < prev    next >
Text File  |  1990-04-17  |  5KB  |  168 lines

  1. -- card: 20541 from stack: in.3
  2. -- bmap block id: 21596
  3. -- flags: 4000
  4. -- background id: 8327
  5. -- name: XScrollBoxML
  6. ----- HyperTalk script -----
  7. on Install
  8.   get ChooseTargetStack()
  9.   InstallResource XFCN,XScrollBoxML,it
  10.   InstallResource DITL,XScrollBoxML,it
  11.   InstallResource DLOG,XScrollBoxML,it
  12. end Install
  13.  
  14.  
  15. -- part 2 (field)
  16. -- low flags: 01
  17. -- high flags: 4007
  18. -- rect: left=383 top=58 right=286 bottom=490
  19. -- title width / last selected line: 0
  20. -- icon id / first selected line: 0 / 0
  21. -- text alignment: 0
  22. -- font id: 3
  23. -- text size: 9
  24. -- style flags: 0
  25. -- line height: 12
  26. -- part name: scroller
  27.  
  28.  
  29. -- part 3 (button)
  30. -- low flags: 00
  31. -- high flags: 8003
  32. -- rect: left=76 top=298 right=320 bottom=176
  33. -- title width / last selected line: 0
  34. -- icon id / first selected line: 0 / 0
  35. -- text alignment: 1
  36. -- font id: 0
  37. -- text size: 12
  38. -- style flags: 0
  39. -- line height: 16
  40. -- part name: XScrollBoxML
  41. ----- HyperTalk script -----
  42. on mouseUp
  43.   put "able,charlie,fox" into initial
  44.   get XScrollBoxML(initial,"Choose among these:",card field "scroller","Help")
  45.   go this card
  46.   if it is "Help" then
  47.     answer "You pushed the 'Help' button."
  48.   else if it is "cancel" then
  49.     answer "You pushed the 'Cancel' button."
  50.   else if it is empty then
  51.     answer "You did not select anything."
  52.   else
  53.     get XScrollBoxML(0,"These are the ones you choose:",it)
  54.   end if
  55. end mouseUp
  56.  
  57.  
  58.  
  59. -- part 5 (field)
  60. -- low flags: 01
  61. -- high flags: 2007
  62. -- rect: left=18 top=32 right=286 bottom=384
  63. -- title width / last selected line: 0
  64. -- icon id / first selected line: 0 / 0
  65. -- text alignment: 0
  66. -- font id: 3
  67. -- text size: 10
  68. -- style flags: 0
  69. -- line height: 13
  70. -- part name: Documentation
  71.  
  72.  
  73. -- part contents for card part 2
  74. ----- text -----
  75. able
  76. baker
  77. charlie
  78. dog
  79. ernest
  80. fox
  81. gamma
  82. horse
  83. ice cream
  84. jumping jack flash
  85. knockwurst
  86. liver
  87. monkey
  88. no way, jose
  89. occularity
  90. penelope
  91. qwerty
  92. rapscallion
  93. salubrious
  94. twinkle toes
  95. underwhelmed
  96. vermin
  97. wascally wabbit
  98. yokel
  99. zenzational
  100.  
  101. -- part contents for card part 5
  102. ----- text -----
  103. XScrollBoxML version 2.4
  104. Roger Brown
  105.  
  106. XScrollBoxML is a version HyperCard XFCN XScrollBox that allows the user to make multiple selections like XScrollBoxM. The difference is that each selection is returned in a separate line of the result.  This makes it easier to handle selection items with embedded commas. 
  107.  
  108.  The return value is a list of lines in the format:
  109.     number,text <cr>
  110.     number,text <cr>
  111.     ..
  112.     number,text
  113.    
  114.    where number is the number of a selection 
  115.      text is the text of the selection with that number
  116.    
  117.     Selection can be made by:
  118.    
  119.    1. double-clicking on a line.
  120.    2. single-clicking on a line, then pressing the OK button.
  121.    3. single-clicking on a line, then pressing the Return key.
  122.    4. typing the first letter(s) of a selection, then doing 1,2, or 3.
  123.      (Note: type selection assumes that the lines are   
  124.                 ordered  alphabetically)
  125.    5. scrolling with up and down arrow keys, then doing 1,2 or 3.
  126.  
  127.    Multiple selection is made by holding down the shift key while    
  128.    clicking.
  129.    
  130.    If the Cancel button is pressed, the string "Cancel" is returned.
  131.     
  132.    It requires that the DITL and DLOG resources (1348) packaged 
  133.    with  it are in the stack.
  134.    
  135.   The dialog is centered on the screen and sized to hold the width of the longest line and/or the prompt line, whichever is widest. It will not overrun the width of a  Mac+ screen.
  136.  
  137. INVOKING XScrollBoxML
  138.  
  139.   get XScrollBoxML(first,prompt,container,userButton)
  140.         
  141.    where  first  is a list of 1 or more default selections in the list - 
  142.                          either numbers or an item list of text strings (0 if 
  143.                          none). NOTE: the text must exactly match what is in 
  144.                          the field!
  145.                prompt is a string to prompt the user. This appears at the 
  146.                          top  of the dialog box.
  147.                container is any hypercard container (field, variable), 
  148.                          presumed to be multi-lined.
  149.                UserButton  is the name for an optional author specified 
  150.                          button. If this button is pressed, its name is returned             
  151.                          further processing by the script.  
  152.                    
  153.  
  154. EXAMPLE
  155.  
  156.  ex.  get XScrollBoxML("1,2,3","Choose:",card field 1,"Help")
  157.         if OK is pressed, returns : 1,text of line 1 of card field 1<cr>
  158.          2,text of line 2 of card field 1<cr>
  159.          3,ext of line 3 of card field 3
  160.  
  161.  
  162. REVISION HISTORY
  163. 2.3 3/30/90 first public release
  164. 2.4 - 4/17/90 revived a feature that had disappeared: specifying    
  165.           the default selection in XScrollBox and XScrollBox F as a 
  166.           string rather than a number
  167.  
  168.